<!doctype html>
<html>
<body>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function log(str)
{
    document.body.appendChild(document.createTextNode(str));
    document.body.appendChild(document.createElement("br"));
}

function addElement(e)
{
    var txt = (e && e.type) || "insertedText";
    log(txt);
}
document.addEventListener("DOMContentLoaded", addElement, false);
window.onload = addElement;

var xhr = new XMLHttpRequest;
function sendXHR()
{
    xhr.open("GET", "", true);
    xhr.onreadystatechange = function() {
        if (xhr.readyState != 4)
            return;
        if (window.testRunner)
            testRunner.notifyDone();
    };
    xhr.send();
}
window.addEventListener("DOMSubtreeModified", sendXHR);
addElement();
</script>
This tests that when we re-entrantly create and cancel XHRs, we don't try to disconnect the same CachedResourceClient
multiple times from its CachedResource. We pass if we don't crash.<br/>
</body>
</html>

